# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day150_pyqt5_control
   Description :
   Author :       fuml
   date：          2019/9/22
-------------------------------------------------
   Change Activity:
                   2019/9/22:In this example, we determine the event sender
object.---QCheckBox
-------------------------------------------------
"""
import  sys
from PyQt5.QtWidgets import QWidget,QCheckBox,QApplication
from PyQt5.QtCore import Qt

class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        cb = QCheckBox('show title',self)
        cb.move(20,20)
        cb.toggle()
        cb.stateChanged.connect(self.changeTitle)

        self.setGeometry(300,300,250,150)
        self.setWindowTitle('QCheckbox')
        self.show()

    def changeTitle(self,state):
        if state == Qt.Checked:
            self.setWindowTitle('QCheckBox')
        else:
            self.setWindowTitle('')

if __name__ == '__main__':
    app =QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())